<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信支付中心</title>
</head>
<body>
<script>
    function onBridgeReady() {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": "{{$package->appId}}",     //公众号名称，由商户传入
                "timeStamp": "{{$package->timeStamp}}",         //时间戳，自1970年以来的秒数
                "nonceStr": "{{$package->nonceStr}}", //随机串
                "package": "{{$package->package}}",
                "signType": "MD5",         //微信签名方式：
                "paySign": "{{$package->paySign}}" //微信签名
            },
            function (res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    window.location.href = '{!! $redirect !!}'
                } else {
                    window.location.href = '{!! $back !!}'
                }
            });
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>

</body>
</html>

